import Cookies from 'js-cookie'

const TokenKey = 'Jrfk-Token';

const RolesKey = 'Jrfk-Roles';

export function getAuth(type) {
    // T : token  R : roleType
    if (type === 'T') {
        return Cookies.get(TokenKey)
    } else if (type === 'R') {
        return Cookies.get(RolesKey);
    } else if (type === 'ID') {
        return Cookies.get('ID');
    }
}

export function setAuth(type, value) {
    if (type === 'T') {
        Cookies.set(TokenKey, value)
    } else if (type === 'R') {
        Cookies.set(RolesKey, value);
    } else if (type === 'ID') {
        Cookies.set('ID', value);
    }
}

export function removeAuth() {
    Cookies.remove(TokenKey);
    Cookies.remove(RolesKey);
    Cookies.remove('ID');
}